package com.cd.learn.cdlearn.pattern.flyweight;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName BoxFactory
 * @Description TODO
 * @Author seven
 * @Date 2021/7/422:55
 * @Version 1.0
 **/
public class BoxFactory {

    private Map<String,AbstractBox> map;

    private BoxFactory(){
        map=new HashMap<>();
        map.put("I",new IBox());
        map.put("L",new LBox());
    }

    public static Map<String, AbstractBox> getInstince() {
        return singletonHolder.INSTANCE.map;
    }

    private static class singletonHolder{
        private static final BoxFactory INSTANCE=new BoxFactory();
    }


}
